use attestation::factory::{
    attestation_factory::{AttestationFactory, AttestationType},
    token_factory::{TokenFactory, TokenType},
};

#[cfg(test)]
mod token_factory_tests {
    use super::*;

    #[test]
    fn test_create_eat_token_should_succeed_with_valid_format() {
        let factory = TokenFactory::new();
        let result = factory.create_token("eat");
        
        assert!(result.is_ok());
    }

    #[test]
    fn test_create_ear_token_should_succeed_with_valid_format() {
        let factory = TokenFactory::new();
        let result = factory.create_token("ear");
        
        assert!(result.is_ok());
    }

    #[test]
    fn test_create_token_should_fail_with_invalid_format() {
        let factory = TokenFactory::new();
        let result = factory.create_token("invalid");
        
        assert!(result.is_err());
    }

    #[test]
    fn test_create_token_should_fail_with_empty_format() {
        let factory = TokenFactory::new();
        let result = factory.create_token("");
        
        assert!(result.is_err());
    }

    #[test]
    fn test_token_type_enum_should_match_correct_variants() {
        let eat_type = TokenType::Eat;
        let ear_type = TokenType::Ear;
        
        match eat_type {
            TokenType::Eat => assert!(true),
            TokenType::Ear => assert!(false),
        }
        
        match ear_type {
            TokenType::Eat => assert!(false),
            TokenType::Ear => assert!(true),
        }
    }
}

#[cfg(test)]
mod attestation_factory_tests {
    use super::*;

    #[test]
    fn test_attestation_type_enum_should_match_default_variant() {
        let _default_type = AttestationType::Default;
        
        match AttestationType::Default {
            AttestationType::Default => assert!(true),
        }
    }
}

#[cfg(test)]
mod integration_tests {
    use super::*;

    #[test]
    fn test_factory_modules_integration_should_work_together() {
        let token_factory = TokenFactory::new();
        let _attestation_strategy = AttestationFactory::create_strategy(AttestationType::Default);
        
        let eat_token = token_factory.create_token("eat");
        let ear_token = token_factory.create_token("ear");
        
        assert!(eat_token.is_ok());
        assert!(ear_token.is_ok());
    }

    #[test]
    fn test_error_handling_consistency_should_fail_for_all_invalid_inputs() {
        let factory = TokenFactory::new();
        
        let invalid_inputs = vec!["invalid", "JWT", "json", "xml", "unknown"];
        
        for input in invalid_inputs {
            let result = factory.create_token(input);
            assert!(result.is_err());
        }
    }
}